<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/echarts@5.3.0/dist/echarts.min.js"></script>
</head>

<body>
    <!-- 饼图 -->
    <div id="Pie" style="width: 600px;height:400px;"></div>


    <!-- 柱状图 -->
    <div id="Histogram" style="width: 600px;height:400px;"></div>


    <!-- 折线图 -->
    <div id="Line" style="width: 600px;height:400px;"></div>
</body>
<script type="text/javascript">
    // 饼图
    var chartDom = document.getElementById('Pie');
    var myChart = echarts.init(chartDom);
    var option;

    option = {
        title: {
            text: '同学分布',
            subtext: '饼图',
            left: 'center'
        },
        tooltip: {
            trigger: 'item'
        },
        legend: {
            orient: 'vertical',
            left: 'left'
        },
        series: [
            {
                name: 'Access From',
                type: 'pie',
                radius: '50%',
                data: [
                    { value: 2, name: '菏泽' },
                    { value: 2, name: '南阳' },
                    { value: 2, name: '濮阳' },
                    { value: 3, name: '洛阳' },
                    { value: 2, name: '信阳' },
                    { value: 1, name: '商丘' }
                ],
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    option && myChart.setOption(option);



    // 柱状图
    var myChart = echarts.init(document.getElementById('Histogram'));
    var option = {
        title: {
            text: '本周消费'
        },
        tooltip: {},
        legend: {
            data: ['本周消费']
        },
        xAxis: {
            data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
        },
        yAxis: {},
        series: [
            {
                name: '消费',
                type: 'bar',
                data: [12, 20, 36, 10, 10, 20, 15]
            },
        ]

    };
    myChart.setOption(option);


    // 折线图
    var myChart = echarts.init(document.getElementById('Line'));
    var option = {
        title: {
            text: '本周消费'
        },
        legend: {
            data: ['消费']
        },
        xAxis: {
            type: 'category',
            data: ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日']
        },
        yAxis: {
            type: 'value'
        },
        series: [
            {
                name: '消费',
                type: 'line',
                data: [12, 20, 36, 10, 10, 20, 15]
            },
        ]
    };
    myChart.setOption(option);
</script>

</html>